﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Win.BLL;
using Win.Model;

namespace ShiYan3
{
    public partial class OrderInfo : Form
    {
        private DishBLL dishBLL = new DishBLL();

        public OrderInfo()
        {
            InitializeComponent();
        }

        private void OrderInfo_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = dishBLL.GetDishInfos();
            dataGridView1.Columns[0].HeaderText = "编号";
            dataGridView1.Columns[1].HeaderText = "菜名";
            dataGridView1.Columns[2].HeaderText = "价格";
            dataGridView1.Columns[3].HeaderText = "种类";
            dataGridView1.Columns[4].Visible = false;
            dataGridView1.Columns[5].Visible = false;
            comboBox1.SelectedIndex = comboBox1.Items.IndexOf("全部");
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string name = dish_name.Text.Trim();
            string type = comboBox1.SelectedItem.ToString();
            dataGridView1.DataSource = dishBLL.GetDishesByNT(name, type);
            dataGridView1.Columns[0].HeaderText = "编号";
            dataGridView1.Columns[1].HeaderText = "菜名";
            dataGridView1.Columns[2].HeaderText = "价格";
            dataGridView1.Columns[3].HeaderText = "种类";
            dataGridView1.Columns[4].Visible = false;
            dataGridView1.Columns[5].Visible = false;
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = int.Parse(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString());
            
        }
    }
}
